import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cl.fcbarcelona.ejb.services.*;

@WebServlet("/fcbarcelona")
public class Main extends HttpServlet {

	private static final long serialVersionUID = 1L;
	@EJB
	private FinanzasServiceRemote finanzasService;
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.getOutputStream().println("Ejemplos de uso: \nhttp://localhost:7001/GeoChileWeb/geo?comuna=Colina&region=Metropolitana%20Santiago\nhttp://localhost:7001/GeoChileWeb/geo?comuna=Colina\nhttp://localhost:7001/GeoChileWeb/geo?region=Metropolitana%20Santiago\n\n");

		int n=0;
		String activoName = request.getParameter("activo");
		if(activoName != null && activoName != ""){
			n = finanzasService.agregarActivo(1, 1);
			response.getOutputStream().println("valor: "+n);

		}
		
		
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request,response);
	}


}